#include "cpu/exec/template-start.h"

make_helper(concat(rep_esi2edi_, SUFFIX)) {
    int32_t times = REG(R_ECX);
	uint32_t src  = cpu.esi;//REG(R_ESI);
	uint32_t dst  = cpu.edi;//REG(R_EDI);
	while(times > 0){
		printf("rep::times = %d, dst = %x, src = %x\n", times, dst, src);		
	    MEM_W(dst, MEM_R(src));
		dst = dst + DATA_BYTE;
		src = src + DATA_BYTE;
		times--;
		cpu.edi = dst;
		cpu.esi = src;
	}
	print_asm("rep movs ds:esi, es:edi");
	return 1;
}

#include "cpu/exec/template-end.h"